import { Body, Controller, Get, Param, Patch, Post, Query, UsePipes } from "@nestjs/common";
import { PipeService } from "./pipe.service";
import { ParseIntPipe } from "src/common/pipes/parse-int.pipe";

@Controller('/usePipe')
export class PipeController{
  constructor(private readonly pipeservice: PipeService){}

  @Get('/1')
  get1(@Query() {id}) {
    return this.pipeservice.get1(id)
  }

  @Post('/1')
  post(@Body('id', new ParseIntPipe()) id ) {
    console.log(id);
    return this.pipeservice.post(id)
  }
  @Post('/2')
  post2(@Body() param) {
    return this.pipeservice.moreParamPost(param)
  }

  @Patch(':id')
  patch(@Param('id', new ParseIntPipe()) id ) {
    console.log(typeof(id));
    return this.pipeservice.patch(id)
  }
}
